# Author: Kishor D. Bhalerao
# Email: kishor8dm@gmail.com

# for graphics.
INCLUDE_DIR=/usr/local/SimTK/include/vtk-5.0/

LIB_DIR = /usr/local/SimTK/lib
#LIBS=
LIBS = -lvtkCommon -lvtkHybrid -lvtkGenericFiltering -lvtkVolumeRendering -lvtksys -lvtkFiltering -lvtkRendering \
      -lvtkIO -lvtkGraphics -lvtkexoIIc -lvtkNetCDF -lvtkImaging -lvtkftgl -lvtkfreetype -lvtkDICOMParser -lvtkpng  \
       -lvtktiff -lvtkzlib -lvtkjpeg -lvtkexpat

# Compiler Tags pedantic Wall Wconversion (Part of CFLAGS)
OPTIM_DEBUG = -DRSIM_VERBOSE -DRSIM_SAFE -m32 -g
CC = g++
CFLAGS = -c $(OPTIM_DEBUG) -Wno-deprecated

# Matrix Libraries
Mat = FastOps.cpp FileIO.cpp
MatInc = CData.h Matrix.h Vector.h MatrixClasses.h FastOps.h FileIO.h LinAlgDecl.h\
	 Vect3.h Vect4.h Vect6.h Mat3x3.h Mat6x6.h 

# Linear Algebra and Math files
LinAlg = LU.cpp QR.cpp Cholesky.cpp Eig.cpp Svd.cpp Integrator.cpp Ode45.cpp Ode23.cpp
LinAlgInc = LU.h QR.h Cholesky.h Eig.h Svd.h Integrator.h Ode45.h Ode23.h

VTKFILES_H = Display.h ColorConstants.h

VTKFILES_CPP = Display.cpp ColorConstants.cpp

# Dynamics Files
BodDatInc = Index.h Force.h Rotation.h Quaternion.h Transform.h Joint.h Pin.h Ball.h MultibodySystem.h RigidBody.h\
	    State.h Stage.h PrescribedMotion.h EOMData.h ABAData.h RigidBodyNode.h MassProperties.h RSIM_INC.h\
            JointType.h JointUtils.h PrismaticZ.h PrismaticX.h Cylinder.h RSIMSmartPointer.h XYZJoint.h FreeJoint.h Weld.h\
	    Reporter.h List.h Constraint.h SystemData.h BallConstraint.h SystemDataUtils.h CoordinateProjection.h\
            CoordinateProjectionUtils.h Utils.h ConstraintUtils.h

BodDatSrc = Force.cpp Rotation.cpp Quaternion.cpp Joint.cpp Pin.cpp Ball.cpp\
	    JointUtils.cpp PrismaticZ.cpp PrismaticX.cpp Cylinder.cpp XYZJoint.cpp FreeJoint.cpp Weld.cpp\
	    RigidBody.cpp RigidBodyNode.cpp MultibodySystem.cpp\
            State.cpp Stage.cpp Transform.cpp EOMData.cpp ABAData.cpp MassProperties.cpp\
	    Reporter.cpp Constraint.cpp SystemData.cpp BallConstraint.cpp SystemDataUtils.cpp CoordinateProjection.cpp\
            CoordinateProjectionUtils.cpp Utils.cpp ConstraintUtils.cpp

# All include files
INC = $(MatInc) $(LinAlgInc) $(LstInc) $(BodDatInc) Makefile

# This is the file with the function main()
MAIN = main01.cpp

MISC_FILES = 

# Source for Matrix Libraries
SRC = $(Mat) $(LinAlg) $(BodDatSrc) $(VTKFILES_CPP) $(MAIN)

FILES = $(SRC) $(INC)

ALL_FILES = $(FILES) $(MISC_FILES)

OBJS = $(SRC:.cpp=.o)
EXE = prog

all: $(SRC) $(EXE)

$(EXE): $(OBJS)
	$(CC) $(OPTIM_DEBUG) $(OBJS) -L$(LIB_DIR) $(LIBS) -o $@

%.o:%.cpp
	$(CC) $(CFLAGS) $< -I$(INCLUDE_DIR) -o $@

clean:
	rm *.o

tar:
	tar -cvf RSIM.tar $(ALL_FILES)
